package org.colafries.admin.wrapper;

/**
 * @author colafries
 * @version v1.0
 * @ClassName ResponseWrapper
 * @Description
 * @date Created in 2024/5/27
 **/
public class ResponseWrapper {

    public ResponseWrapper() {

    }

    public static <E> Response<E> resp(String code, String message, E o) {
        return new Response<>(code, message, o);
    }

    public static <E> Response<E> resp(String code, String message) {
        return resp(code, message, (E) null);
    }

    public static <E> Response<E> error() {
        return resp(Response.ERROR_CODE, Response.ERROR_MESSAGE);
    }

    public static <E> Response<E> error(String message) {
        return resp(Response.ERROR_CODE, message);
    }

    public static <E> Response<E> ok() {
        return new Response<>();
    }

    public static <E> Response<E> ok(E o) {
        return new Response<>(Response.SUCCESS_CODE, Response.SUCCESS_MESSAGE, o);
    }
}
